<%@page import="org.yate.oa.model.LoginEntity"%>
<%@page import="java.text.SimpleDateFormat, java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set value="${pageContext.request.contextPath}" var="ctx" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>销假</title>
<link href="${ctx}/css/skin.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/css/page.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/css/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/css/jquery-ui-timepicker-addon.css" rel="stylesheet"
	type="text/css" />
<style type="text/css">
table {
	table-layout: fixed;
}

#staffs td {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
</style>
<script type="text/javascript" src="${ctx}/js/jquery.js"></script>
<script type="text/javascript" src="${ctx}/js/backOffice.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery.myPagination.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery-ui-sliderAccess.js"></script>
<script type="text/javascript"
	src="${ctx}/js/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		for ( var i = 0.5; i <= 100; i += 0.5) {
			$("#selDays").append("<option value='"+i+"'>" + i + "</option>");
		}
		$("#beginDate").datetimepicker();
	});

	function submitCancel() {
		var userName = $.trim($('#userName').val());
		if (userName == "") {
			$.msgbox.show({
				message : '申请人不能为空',
				icon : 'no'
			});
			return false;
		}
		var beginDate = $.trim($("#beginDate").val());
		if (beginDate == "") {
			$.msgbox.show({
				message : '开始日期不能为空',
				icon : 'no'
			});
			return false;
		}
		beginDate = new Date(beginDate);
		var day = $('#selDays').select().val();
		var taskType = $('#cancelType').select().val();
		var obj = {};
		obj.type = 'cancel';
		obj.beginDate = beginDate.getTime();
		obj.day = day;
		obj.taskType = taskType;
		obj.userName = userName;
		$.ajax({
			type : 'post',
			url : '${ctx}/leave/post',
			data : obj,
			dataType : 'json',
			success : function(data) {
				if (data.status == 200) {
					$.msgbox.show({
						message : '提交成功',
						icon : 'ok'
					});
					newform.reset();
				} else if (data.status == 201) {
					$.msgbox.show({
						message : data.msg,
						icon : 'no'
					});
				} else if (data.status == 202) {
					$.msgbox.show({
						message : data.msg,
						icon : 'no'
					});
				}
			}

		});
	}
</script>
</head>
<body style="font-size: 62.5%;">
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td width="17" height="29" valign="top"
				background="${ctx}/images/mail_leftbg.gif"><img
				src="${ctx}/images/left-top-right.gif" width="17" height="29" /></td>
			<td width="" height="29" valign="top"
				background="${ctx}/images/content-bg.gif"><table width="100%"
					height="31" border="0" cellpadding="0" cellspacing="0"
					class="left_topbg" id="table2">
					<tr>
						<td height="31"><div class="titlebt">销假管理</div></td>
					</tr>
				</table></td>
			<td width="16" valign="top"
				background="${ctx}/images/mail_rightbg.gif"><img
				src="${ctx}/images/nav-right-bg.gif" width="16" height="29" /></td>
		</tr>
		<tr>
			<td height="71" valign="middle"
				background="${ctx}/images/mail_leftbg.gif">&nbsp;</td>
			<td valign="top" bgcolor="#F7F8F9"><table width="100%"
					height="138" border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td height="13" valign="top">&nbsp;</td>
					</tr>
					<tr>
						<td valign="top"><table width="98%" border="0" align="center"
								cellpadding="0" cellspacing="0">
								<tr>
									<td class="left_txt">当前位置：销假管理</td>
								</tr>
								<tr>
									<td height="20"><table width="100%" height="1" border="0"
											cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
											<tr>
												<td></td>
											</tr>
										</table></td>
								</tr>
								<tr>
									<td><table width="100%" height="31" border="0"
											cellpadding="0" cellspacing="0" class="nowtable">
											<tr>
												<td class="left_bt2">&nbsp;&nbsp;&nbsp;&nbsp;<a
													href="cancelLeaveList.jsp">查看销假历史记录</a></td>
											</tr>
										</table></td>
								</tr>
								<tr>
									<td><table width="100%" height="31" border="0"
											cellpadding="0" cellspacing="0" class="nowtable">
											<tr>
												<td class="left_bt2">&nbsp;&nbsp;&nbsp;&nbsp;销假</td>
											</tr>
										</table></td>
								</tr>
								<tr>
									<td width="100%" valign="top"
										style="min-height: 350px; height: 350px;">
										<form name="newform">
											<table class="tblExcel" cellpadding="0" cellspacing="0">
												<thead>
													<tr>
														<td height="30" width="4%" class="left_txt2">销假申请人：<input
															type="text" id="userName" />
														</td>
													</tr>
													<tr>
														<td height="30" width="4%" class="left_txt2">销假开始时间：<input
															id="beginDate" type="text" readonly="readonly"
															style="width: 230px;" /> <span class="spanError"
															id="errBeginDate"></span>
														</td>
													</tr>
													<tr>
														<td height="30" width="4%" class="left_txt2">销假类型：<select
															id="cancelType">
																<option value="paidleave" selected="selected">调休</option>
																<option value="leave">请假</option>
																<option value="annual">年假</option>
														</select>
														</td>
													</tr>
													<tr>
														<td height="30" width="4%" class="left_txt2">销 假 天 数：<select
															id="selDays" name="selDays"></select>
														</td>
													</tr>
													<tr>
														<td height="30" width="4%" class="left_txt2"><input
															type="button" value="提交" onclick="submitCancel()" /></td>
													</tr>
												</thead>
												<tbody id="staffs"></tbody>
											</table>
										</form>
									</td>
								</tr>
							</table></td>
					</tr>
				</table></td>
			<td background="${ctx}/images/mail_rightbg.gif">&nbsp;</td>
		</tr>
		<tr>
			<td valign="middle" background="${ctx}/images/mail_leftbg.gif"><img
				src="${ctx}/images/buttom_left2.gif" width="17" height="17" /></td>
			<td height="17" valign="top"
				background="${ctx}/images/buttom_bgs.gif"><img
				src="${ctx}/images/buttom_bgs.gif" width="17" height="17" /></td>
			<td background="${ctx}/images/mail_rightbg.gif"><img
				src="${ctx}/images/buttom_right2.gif" width="16" height="17" /></td>
		</tr>
	</table>
</body>
</html>